import {
  Controller,
  Get,
  Param,
  Post,
  UploadedFile,
  UseInterceptors,
  Render,
  Query,
  HttpException,
  HttpStatus,
} from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { Express } from 'express';
import { SharedService } from '@/modules/shared/shared.service';
import * as moment from "moment"
import IResponse from '@/services/response.service';
import IGlobal from '@/services/global.service';

@Controller('shared')
export class SharedController {
  constructor(private readonly sharedService: SharedService) {}

  @Post('upload')
  @UseInterceptors(FileInterceptor('file'))
  upload(@UploadedFile() file: Express.Multer.File) {
    return this.sharedService.upload(file);
  }

  @Get("puppeteer-screenshot")
  @Render("puppeteer-screenshot")
  renderPuppeteerScreenshot(@Query() query: {id: string, text: string, video_size: string}) {
    console.log(query)
    return {...query}
    // return this.sharedService.renderPuppeteerScreenshot(query)
  }

  @Get("debug/:id")
  debug(@Param("id") id: number) {
    return this.sharedService.debug(id)
  }
}
